package com.wisnews.controller.util;

import com.wisnews.pojo.Result;
import com.wisnews.service.CrawlDataAutoSchedService;
import com.wisnews.util.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description：爬虫蜘蛛控制类
 * @Author: yuyd
 * @Email: yyd8358@foxmail.com
 * @Date: 2020/12/25 15:26
 * @Version 1.0
 */
@RestController
public class DataSpiderController {

    @Autowired
    private CrawlDataAutoSchedService autoSchedService;

    @RequestMapping("beginCrawlData")
    public Result beginCrawlData(){

        autoSchedService.crawlData();
        return new Result(Constants.SYS_CODE.SUCCESS, Constants.SYS_CODE.SUCCESS_MESSAGE);
    }

    @RequestMapping("stopcrawlData")
    public Result stopcrawlData(){

        autoSchedService.stopcrawlData();
        return new Result(Constants.SYS_CODE.SUCCESS, Constants.SYS_CODE.SUCCESS_MESSAGE);
    }

}
